import pyautogui


# 模拟按键
pyautogui.press('a')

# 输出字符串
pyautogui.typewrite('Hello world!')


